﻿using System.Web.Mvc;
using PTop.Application.Biz;
using PTop.Code;
using PTop.Domain.Entity.Biz;

namespace PTop.Web.Areas.Biz.Controllers
{
    /// <summary>
    /// 工作招聘Controller
    /// </summary>	
    public class JobRecruitController : ControllerBase
    {
        private JobRecruitApp _app = new JobRecruitApp();

        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(Pagination pagination, string keyword, int state)
        {
            var data = _app.GetList(pagination, keyword, state);
            return PageContent(pagination.records, pagination.rows, data);
        }
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetFormJson(string keyValue)
        {
            var data = _app.GetForm(keyValue);
            return Content(data.ToJson());
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [ValidateAntiForgeryToken]
        public ActionResult SubmitForm(JobRecruitEntity entity, string keyValue)
        {
            _app.SubmitForm(entity, keyValue);
            return Success("操作成功。");
        }
        [HttpPost]
        [HandlerAjaxOnly]
        [HandlerAuthorize]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteForm(string keyValue)
        {
            _app.Delete(keyValue);
            return Success("删除成功。");
        }
    }
}